<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <ul>
    <li>首页</li>
    <li>科技</li>
    <li>汽车</li>
  </ul>
  <script>
    // 存储this指向
    var lis = document.querySelectorAll("ul li")
    for (var i = 0; i < lis.length; i++) {
      lis[i].onclick = function () {
        // this--当前点击的li
        var that = this;
        setTimeout(function () {
          // this----window
          that.style.background = "red";
        }, 2000)
      }
    }




  </script>
</body>

</html>